﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json.Linq;

namespace Wala.Connection.Objects.Authen
{
    public class RetSaltKey
    {
        #region //--------- Private Fields -----------//

        private string _saltkey;        

        #endregion

        #region //---------- CLR Properties -----------//

        public string Saltkey
        {
            get { return _saltkey; }
            set { _saltkey = value; }
        }

        #endregion

        #region //----------- Public Contructor -----------//

        public RetSaltKey()
        {
            _saltkey = "";
        }

        public RetSaltKey(string _saltkey)
        {
            this._saltkey = _saltkey;
        }
        
        #endregion

        #region //----------- Public Methods --------------//

        public static RetSaltKey FromJson(string json)
        {
            try
            {
                JObject jObject = JObject.Parse(json);
                string saltkey = (string)jObject["saltkey"];

                return new RetSaltKey(saltkey);
            }
            catch (Exception ex)
            {
                return new RetSaltKey();
            }
        }

        #endregion
    }
}
